<?php
$isReloadable = true;
require_once("../../../pers/inc.config.php");
require_once OVF_FS_WEB_ROOT.'/app/_inc/inc.session.php';
require_once OVF_FS_WEB_ROOT.'/app/_inc/funct.html.php';
require_once OVF_FS_WEB_ROOT.'/app/_inc/class.ovfLista.php';

$objSess->setReqSV('rcom', 'anagCamp', 'camp');
$oLista = new ovfLista('campagne',reqVar('codList'));
$sHtmlListaLab = $oLista->getHtmlLab('rcom/camp');
$aWhere = array();
$sOrder = $oLista->sOrder;
if ($oLista->sPagiFilt != '') {
	$aWhere[] = $oLista->sPagiFilt;
}

$sWhere = (count($aWhere)==0)? "":" WHERE ".implode(" AND ",$aWhere);
$sql_sel = "SELECT count(*) AS num_rec " .
		" FROM ovf_campagne C " .$sWhere;
//dbg_($sql_sel);
$objDB->query($sql_sel,'selRec');
$acRec = $objDB->fetch('selRec');
$numRec = $acRec['num_rec'];
$link = $_SERVER['PHP_SELF']."?".$sXSNQS;
$startOffset = 0;
$endOffset = 0;
$sFiltro = ovfGetFiltro($link);
$sPaginaz = ovfGetPaginaz($link, $numRec, $startOffset, $endOffset);

$sql_sel = "SELECT C.id_camp " .
		" FROM ovf_campagne C " .$sWhere.
		" ORDER BY C.descr ".
		" LIMIT ".$startOffset.",".($endOffset-$startOffset);
$objDB->query($sql_sel,'selRec');
$cmdL = "";
$cmdR = "";
$cmdR .= cmdTorna(); 

testaHtml('Campagne','Lista', $msgPag, 'rcom');
echo getHtmlForm();
echo getHtmlHidden('xsn',XSN);
echo getHtmlHidden('startoffset');
?>
<table class="cmd1" border="0" cellpadding="3" cellspacing="1" width="100%" align='center'>
   <tr>
      <td class="cmd1" align="left">
         <?=$cmdL?>
      </td>
      <td class="cmd1" align="right">
         <?=$cmdR?>
      </td>
   </tr>
   <tr>
      <td class="cmd1" align="left">
			<?=$sFiltro?>
      </td>
      <td class="cmd1" align="right">
			<?=$sPaginaz?>
      </td>
   </tr>
</table>
<table class="tab1" border="0" cellpadding="3" cellspacing="1" width="100%" align='center'>
<?echo getHtmlRigaRif(21);?>
   <tr>
      <?php echo $sHtmlListaLab?>
      <td class='lab1' colspan='1'>&nbsp;</td>
   </tr>
<? 
$clRF = 'txt2';
while($acZ = $objDB->fetch('selRec')) { 
	$clRF = ($clRF=='txt1')?'txt2':'txt1';	
	$sSql = "SELECT ".$oLista->getCampiSelect('C')." FROM ovf_campagne C WHERE C.id_camp = ".$acZ['id_camp'];
	$acX = $objDB->query($sSql,'selRecX');
	$acX = $objDB->fetch('selRecX');
	$aOpt1 = array("class"=>$clRF);
	$aOpt1['href'] = "campView.php?idCamp=".$acX['C_id_camp']."&$sXSNQS";
	echo "<tr>\n";
	echo $oLista->getHtmlDat($acX,$aOpt1);
   echo "<td class='$clRF' colspan='1' align='center'>";
	echo "<a href='campView.php?idCamp=".$acX['C_id_camp']."&$sXSNQS' class='$clRF'>\n";
	echo "<img src='".OVF_URL_ROOT."/app/_img/b_edit.png' border='0'>";
	echo "</a>";
	echo "</td>\n";
	echo "</tr>\n";
 } ?>
</table>
<table class="cmd1" border="0" cellpadding="3" cellspacing="1" width="100%" align='center'>
   <tr>
      <td class="cmd1" align="right">
<?=$sPaginaz?>
      </td>
   </tr>
</table>
<?
echo "</form>\n";
codaHtml();
exit();
?>
